package kr.hkit.powerjava.chapter16.work;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.EventQueue;
import java.awt.Font;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.text.AbstractDocument.Content;
import javax.swing.BoxLayout;

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.GridLayout;
import java.awt.CardLayout;

class Counter extends JFrame implements ActionListener{
	private JLabel[] lbls;
	private JButton btn;
	private int[] numbers;
	JPanel panel = new JPanel();
	JPanel panel2 = new JPanel();
	Container con = new Container();
	
	public Counter(){
		setSize(500,300);
		panel.setLayout(new GridLayout(0, 1, 0, 0));
		panel2.setLayout(new GridLayout(0, 1, 0, 0));
		lbls = new JLabel[3];
		numbers = new int[3];

		for(int i = 0 ; i<3; i++){
			lbls[i] = new JLabel(" " + numbers);
			lbls[i].setFont(new Font("Serif", Font.BOLD,30));
			lbls[i].setSize(100,100);
			lbls[i].setLocation(100 + 100 * i, 200);
			panel.add(lbls[i]);
		}
	
		con.add(panel);
		con.add(panel2);
		setVisible(true);
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		for(int i = 0; i<3; i++){
			numbers[i] = (int) (Math.random()*10);
			lbls[i].setText(""+numbers[i]);
		}
	}
}

public class CounterTest2 {
	public static void main(String[] args) {
		Counter c = new Counter();
	}
}
